package ${javaPackage}<#if javaPackage?? && javaPackage != ''>.</#if>model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * @Description: <#if tableComment?? && tableComment != ''>${tableComment}</#if>
 * @Author: ${author}
 * @Date: ${.now?string["yyyy-MM-dd"]}
 * @Version: ${version}
 */
@Data
@TableName("${tableName}")
@Accessors(chain = true)
@ApiModel(value = "${tableName}对象", description = "<#if tableComment?? && tableComment != ''>${tableComment}</#if>")
public class ${modelName} implements Serializable {
  <#list columns as po>

  <#if po.columnComment?? && po.columnComment != ''>
    /**
     * ${po.columnComment}
     */
  </#if>
  <#if po.isPrimaryKey>
    <#if po.isAutoIncrement>
    @TableId(type = IdType.AUTO)
    <#else>
    @TableId(type = IdType.ASSIGN_ID)
    </#if>
  <#else>
    @TableField("${po.columnName}")
  </#if>
  <#if po.columnComment?? && po.columnComment != ''>
    @ApiModelProperty(value = "${po.columnComment}")
  </#if>
  <#if po.dataType == 'date' || po.dataType == 'DATE'>
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
  <#elseif po.dataType == 'datetime' || po.dataType == 'DATETIME' || po.dataType == 'timestamp' || po.dataType == 'TIMESTAMP'>
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  </#if>
    private ${po.fieldType} ${po.fieldName};
  </#list>
}
